//有序数组中出现次数超过25%的元素
https://leetcode.cn/problems/element-appearing-more-than-25-in-sorted-array/description/

class Solution {
public:
    int findSpecialInteger(vector<int>& arr) 
    {
        int n = arr.size();

        int target = -1;
        int sum = 0;
        float tmp = n / 4;

        for(int i = 0; i < n; i++)
        {
            if(target != arr[i])
            {
                target = arr[i];
                sum = 0;
            }
            sum++;
            if(sum > tmp) return target;
        }
        return target;    
    }
};